/*
 *  Copyright 2011 Yuri Kanivets
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.auoem.radio.common.custview.wheel.adapter;

import android.content.Context;

import com.auctus.am.framework.picker.IIntPickDataWrap;
import com.auoem.radio.R;


/**
 * The simple Array wheel adapter
 */
public class ControlWheelAdapter extends AbstractWheelTextAdapter {

    private IIntPickDataWrap pickDataWrap;

    public void update(IIntPickDataWrap pickDataWrap, int curIndex) {
        this.pickDataWrap = pickDataWrap;
    }

    /**
     * Constructor
     *
     * @param context      the current context
     * @param pickDataWrap
     */
    public ControlWheelAdapter(Context context, IIntPickDataWrap pickDataWrap) {
        super(context, R.layout.custview_wheel_text);
        this.pickDataWrap = pickDataWrap;
    }

    @Override
    public CharSequence getItemText(int index) {
        return pickDataWrap.getDisp(index);
    }

    @Override
    public int getItemsCount() {
//        LogMini.d("WheelAdapter", "count: " + pickDataWrap.getSize());
        return pickDataWrap.getSize();
    }

}
